<?php


namespace dsp\iterator;


class Main extends \kernel\BaseMain
{

    public function execute($choice = 'all')
    {
        $collection = new WordsCollection();
        $collection->addItem('First');
        $collection->addItem('Second');
        $collection->addItem('Third');

        echo "Straight traversal" . PHP_EOL;
        foreach ($collection->getIterator() as $item) {
            echo $item . PHP_EOL;
        }

        echo PHP_EOL;
        echo "Reverse traversal" . PHP_EOL;
        foreach ($collection->getReverseIterator() as $item) {
            echo $item . PHP_EOL;
        }
    }
}